<?php
/**
 * Eren Framework
 * 
 * Only entrance of this system
 * 
 * @category System
 * @author Manu Leu
 * @email eshifang@gmail.com
 */

/*
 * Init environment
 */
error_reporting(E_ALL);
ini_set('display_errors', 'On');
date_default_timezone_set('Asia/Shanghai');
define('PROJECT_PATH', dirname(dirname(__FILE__)) . '/');
require_once PROJECT_PATH . 'Library/Eren/AutoLoad.php';

define('HOST', Config_Default::getHost());
define('JS_PATH', Config_Default::getJsPath());
define('CSS_PATH', Config_Default::getCssPath());
define('IMG_PATH', Config_Default::getImgPath());
define('UPLOAD_PATH', Config_Default::getUploadPath());
define('STATIC_VERSION', Config_Default::getStaticVersion());
define('COMPANY_NAME', Config_Default::getCompanyName());
define('COMPANY_TITLE', Config_Default::getCompanyTitle());

Eren_Registry::set('DB', Eren_DB::factory('Eren_DB_MySQL', Config_Default::getDBConfig()));

Eren_Registry::set('SESSION', Eren_Session::factory());

Model_User::autoSignIn();

/*
 * Init PlugIn
 */
Eren_PlugIn::regist(new PlugIn_Init);

/*
 * Start dispatch
 */
Eren_Front::getInstance()->dispatch();
exit;
